package com.tth.learn.addproperties.java;

/**
 * 创建线程方式二：实现Runnable接口
 *
 * @Author tth
 * @Date 2022/10/31 11:37
 */
public class ThreadDemo2 {
    public static void main(String[] args) {
        MyThread3 thread3 = new MyThread3();
        Thread thread = new Thread(thread3);
        thread.start();
    }
}

class MyThread3 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            if (i % 2 != 0) {
                System.out.println(Thread.currentThread().getName() + ":" + i);
            }
        }
    }
}
